package com.example.leetcode.linkedlist;

import com.example.leetcode.linkedlist.common.LinkedListUtils;
import com.example.leetcode.linkedlist.common.ListNode;

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode() {}
 *     ListNode(int val) { this.val = val; }
 *     ListNode(int val, ListNode next) { this.val = val; this.next = next; }
 * }
 */
class Solution206 {
    public ListNode reverseList(ListNode head) {
        return LinkedListUtils.reverseList(head);
    }
}

public class leetcode206 {
    public static void main(String[] args) {
        Solution206 solution206 = new Solution206();
        int[] nums = {1,2,3,4,5};
        int[] nums1 = {1,2};
        int[] nums2 = {};
        test206(solution206, nums);
        test206(solution206, nums1);
        test206(solution206, nums2);
    }

    private static void test206(Solution206 solution206, int[] nums) {
        ListNode listNode = solution206.reverseList(LinkedListUtils.generateLinkedListByArray(nums));
        System.out.println(LinkedListUtils.getLinkedListVals(listNode));
    }
}
